/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nanosn.coffeemaker.application.commands;

import com.nanosn.coffeemaker.application.commands.generate.GWT;
import com.nanosn.coffeemaker.application.commands.generate.ModelsAPI;
import com.nanosn.coffeemaker.application.commands.generate.Persistence;
import com.nanosn.coffeemaker.application.commands.generate.RestAPI;
import com.nanosn.coffeemaker.application.commands.generate.View;
import com.nanosn.util.parsers.commandline.Command;
import com.nanosn.util.parsers.commandline.CommandsRegistry;
import java.util.ArrayList;
import java.util.Arrays;

/**
 *
 * @author selkhateeb
 */
public class Generate implements Command {

    CommandsRegistry commandsRegistry = new CommandsRegistry(
            Persistence.class,
            View.class,
            ModelsAPI.class,
            RestAPI.class,
            GWT.class);

    @Override
    public void run(String[] args) throws Exception {

        ArrayList<String> largs = new ArrayList<String>(Arrays.asList(args));
        largs.remove(0);
        commandsRegistry.run(largs.toArray(new String[largs.size()]));
    }

    @Override
    public String getHelp() {
        return commandsRegistry.getHelp();
    }
}
